Skip to content

Support coalesce/min/max operations on all formulas#8

Merged
shsms merged 13 commits into
frequenz-floss:v0.x.xfrom
shsms:coalesce-all-formulas
Aug 7, 2025
Merged

Support coalesce/min/max operations on all formulas#8
shsms merged 13 commits into
frequenz-floss:v0.x.xfrom
shsms:coalesce-all-formulas

Conversation

@shsms
Copy link
Copy Markdown
Collaborator

@shsms shsms commented Jul 25, 2025

No description provided.

Copilot AI review requested due to automatic review settings July 25, 2025 16:46
@shsms shsms marked this pull request as draft July 25, 2025 16:46

This comment was marked as outdated.

shsms added 9 commits July 28, 2025 11:43
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
And make it internal.  There will be a new `Formula` trait that
implements additional formula operations that will depend on
`FormulaSubscriber`.

Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
This just exposes the same methods from the component graph's Formula
trait, but with metric comparison and retaining the ability to
subscribe to them.

Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
@shsms shsms force-pushed the coalesce-all-formulas branch from 92a2c76 to 1c4e664 Compare July 28, 2025 13:46
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
@shsms shsms changed the title Generic formula operations Support coalesce/min/max operations on all formulas Jul 28, 2025
@shsms shsms marked this pull request as ready for review July 28, 2025 14:23
@shsms shsms added the cmd:skip-release-notes It is not necessary to update release notes for this PR label Jul 28, 2025
@shsms shsms requested review from Copilot and niklas-timpe July 28, 2025 14:23
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR extends the formula system to support coalesce, min, and max operations on all formula types, replacing a hard-coded component-specific coalesce method with a generic trait-based approach.

  • Introduces a generic Formula trait with coalesce/min/max operations that works with all formula types
  • Refactors the formula system using trait-based design with GraphFormulaProvider and FormulaSubscriber traits
  • Adds a new component method to access metrics for individual components by ID

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/logical_meter/logical_meter_handle.rs Removes hard-coded coalesce method, adds generic component method, updates documentation
src/logical_meter/formula/graph_formula_provider.rs Refactors macro system to support component ID parameter and updates trait implementations
src/logical_meter/formula/coalesce_formula.rs Implements new trait system with conversion methods for FormulaParams
src/logical_meter/formula/aggregation_formula.rs Implements new trait system and updates arithmetic operations to use FormulaParams
src/logical_meter/formula.rs Introduces new trait system with generic Formula trait supporting coalesce/min/max operations
examples/logical_meter.rs Updates example to demonstrate new coalesce functionality and improves logging configuration
Cargo.toml Updates component graph and formula engine dependencies to newer revisions

Comment thread src/logical_meter/formula.rs
Comment thread src/logical_meter/formula.rs
Comment thread src/logical_meter/formula.rs
Comment thread src/logical_meter/formula.rs
shsms added 3 commits July 29, 2025 16:02
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Because we are exposing it publicly now, it doesn't have to be hidden
away in a separate module anymore.

Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
@shsms shsms added this pull request to the merge queue Aug 7, 2025
Merged via the queue into frequenz-floss:v0.x.x with commit 2bea387 Aug 7, 2025
3 checks passed
@shsms shsms deleted the coalesce-all-formulas branch August 7, 2025 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmd:skip-release-notes It is not necessary to update release notes for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants